from django.core.cache import cache

from utils.common_response import APIResponse



#增加缓存装饰器
def add_cache(hour):
    def jsh(*args,**kwargs):
        data = cache.get('check_banner')

        if not data:
            res = hour(*args, **kwargs)
            data = res.data.get('data')
            cache.set('check_banner', data)
        return APIResponse(data=data)
    return jsh




